package com.appjishu.web.controller;

import java.math.RoundingMode;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.appjishu.passport.annotation.AuthController;
import com.appjishu.passport.intercepter.LoginInterceptor;
import com.appjishu.web.biz.cache.BussinessCache;
import com.appjishu.web.biz.param.StaffRankParam;
import com.appjishu.web.model.StLevel;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @author edmond
 * @date 2021/10/01
 */
@CrossOrigin(maxAge = 3600)
@Api(tags = "等级")
@AuthController
@RestController
@RequestMapping("/level")
public class StLevelController {
    private static final Logger logger = LoggerFactory.getLogger(StLevelController.class);
    
    @Autowired
    private BussinessCache cache;

    @ApiOperation(value = "等级-段位", notes = "员工等级-段位")
    @RequestMapping(value = "/info", method = RequestMethod.POST)
    public Map<String, Object> levelInfo(@RequestBody StaffRankParam param, HttpServletRequest req) {
        Long userId = LoginInterceptor.getUserId();
        Map<String, Object> res = new HashMap<String, Object>();
        
        
//        StLevel lvName = cache.getLvName(item.getScore());
//        res.put("lvName", lvName.getName());
//        res.put("score", item.getScore());
//        res.put("rank", item.getSeq());
//        res.put("needScore", lvName.getMaxScore().subtract(item.getScore()).setScale(2, RoundingMode.HALF_UP));
        return res;
    }
    
}
